target = libsevent.a
srcs = Thread.cpp ThreadPool.cpp Socket.cpp Connect.cpp Task.cpp Loop.cpp Server.cpp
libs = log/lib/liblog.a
subdirs = log
INCLUDE = -I./ -Ilog/include/
LIBRARY = -lpthread -lrt
CPPFLAGS = -g -ggdb
all : $(target)

objs=$(patsubst %.cpp, %.o, $(srcs))

all : $(target)

$(target) : $(objs) 
	for dir in $(subdirs); do make -C $$dir ; done
	ar cr $(target) $^ $(libs)
#	g++ $(INCLUDE) $(CPPFLAGS) -o $(target) $^ $(libs) $(LIBRARY) 

%.o : %.cpp
	g++ $(INCLUDE) $(CPPFLAGS) $< -c -o $@

.PHONY : clean
clean:
	rm -f $(objs)
	rm -f $(target)
